package com.huangdemo.controller;

import com.huangdemo.dao.first.StudentMapper;
import com.huangdemo.dao.second.LessonMapper;
import com.huangdemo.dao.three.RunoobTblMapper;
import com.huangdemo.model.Lesson;
import com.huangdemo.model.RunoobTbl;
import com.huangdemo.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/multidb")
public class MultiDbController {

	@Autowired
	private LessonMapper lessonMapper;
	@Autowired
	private StudentMapper studentMapper;
	@Autowired
	RunoobTblMapper runoobTblMapper;

	@GetMapping("/getLesson")
	public List<Lesson> getLessons(){
		return lessonMapper.findById(1);
	}

	@GetMapping("/getStudents")
	public List<Student> getStudents(){
		return studentMapper.queryStudents();
	}

	@GetMapping("/selectList")
	public List<RunoobTbl> selectList(){
		return runoobTblMapper.selectList();
	};
}
